package plugins.dice;

import java.util.Random;

/**
 *
 * @author Halarion
 * @date 2008-02-27 22:15
 * 
 * Creates numbers randomly according to given min and max value
 * @params: int diceCount number of dices (numbers which need to created)
 *          int diceSides number of Sides the dice has, equals maximum number
 * @return: List of numbers
 * @exceptions:
 *
 */

public class DiceModell 
{
	public int diceCount;
	public int diceSides;
	
	public DiceModell (int diceCount, int diceSides)
	{
		if(diceCount <= 0 || diceSides <= 0)
			throw new IllegalArgumentException("no negative values or zero allowed.");
			
		this.diceCount = diceCount;
		this.diceSides = diceSides;
	}

    /**
     * Creates random numbers, maximum value declared by diceSides,
     * number of numbers declared by diceCount
     * @return List with random numbers
     */
	
    public int[] DiceThrow()
    {
        Random dice = new Random();
        int diceresults[] = new int[diceCount];
        for(int i = 1; i <= diceresults.length; i++)
        {
        	int r = dice.nextInt(diceSides);
        	diceresults[i] = r;
        }
        	
        return diceresults;
    }
}